package edu.bu.cs673.superkids123.children.model;

import java.util.ArrayList;
import java.util.Collection;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

@Entity
@Table(name="GameQuestions")
public class Question {
	
	/**
	 * @author Abdelghani Bhalla
	 */
	public Question(String question, String name, boolean isActive, int points) {
		super();
		this.question = question;
		this.name = name;
		this.isActive = isActive;
		this.points = points;
	}

	@Id @GeneratedValue
	@Column(name="GameQuestionsID")
	private int id;
	
	@Column(name="Question")
	private String question;
	
	@Column(name="QuestionName")
	private String name;
	
	@Column(name="IsActive")
	private boolean isActive;
	
	@Column(name="Points")
	private int points;
	
	@ManyToOne
	@JoinColumn(name="GameID")
	@NotFound(action=NotFoundAction.IGNORE)
	private Game game;
	
	@OneToMany(mappedBy="question")
	private Collection<Answer> answers = new ArrayList<Answer>();
	
	public Collection<Answer> getAnswers() {
		return answers;
	}
	public void setAnswers(Collection<Answer> answers) {
		this.answers = answers;
	}

	public Game getGame() {
		return game;
	}
	public void setGame(Game game) {
		this.game = game;
	}
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getQuestion() {
		return question;
	}
	public void setQuestion(String question) {
		this.question = question;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public boolean isActive() {
		return isActive;
	}
	public void setActive(boolean isActive) {
		this.isActive = isActive;
	}
	public int getPoints() {
		return points;
	}
	public void setPoints(int points) {
		this.points = points;
	}
	
	public Question(){
		
	}
}
